package main

import (
	"database/sql"
	"fmt"
)
import _ "github.com/go-sql-driver/mysql"

func main() {
	db, e := sql.Open(
		"mysql",
		"root:root@tcp(127.0.0.1:3306)/gogogo?charset=utf8",
	)
	defer db.Close()
	if e != nil {
		fmt.Println("connect mysql error.", e.Error())
		return
	}
	fmt.Println(db)
	e = db.Ping()
	if e != nil {
		fmt.Println("ping db error.", e.Error())
	}
}
